package org.pixelami.twisted.spread.pb
{
	import org.pixelami.twisted.utils.__builtin__;
	
	public class RemoteMethod
	{
		/*
		This is a translucent reference to a remote message.
		*/
		public var obj:Object;
		public var name:Object;
		
		
		public function RemoteMethod(obj:Object, name:Object)
		{
			/*
			"""Initialize with a L{RemoteReference} and the name of this message.
	        """
	        */
	        this.obj = obj;
	        this.name = name;
	 	}
	
	    public function __cmp__(other:Object):Boolean
	    {
	        return __builtin__.cmp((this.obj, this.name), other)
	    }
		
	    public function __hash__():Object
	    {
	        return __builtin__.hash([this.obj, this.name]);
	    }
	
	    //public function __call__(*args, **kw)
	    public function __call__(...args):Object
	    {
	        /*
	        Asynchronously invoke a remote method.
	        */
	        //return this.obj.broker._sendMessage('',this.obj.perspective, this.obj.luid,  this.name, args, kw)
	        return this.obj.broker._sendMessage('',this.obj.perspective, this.obj.luid,  this.name, args, {})
	    }
	

	}
}

/*
class RemoteMethod:
	    """This is a translucent reference to a remote message.
	    """
	    def __init__(self, obj, name):
	        """Initialize with a L{RemoteReference} and the name of this message.
	        """
	        self.obj = obj
	        self.name = name
	
	    def __cmp__(self, other):
	        return cmp((self.obj, self.name), other)
	
	    def __hash__(self):
	        return hash((self.obj, self.name))
	
	    def __call__(self, *args, **kw):
	        """Asynchronously invoke a remote method.
	        """
	        return self.obj.broker._sendMessage('',self.obj.perspective, self.obj.luid,  self.name, args, kw)
	
*/